function getScroll(){
    if(window.pageYOffset){
        return {
            top:window.pageYOffset,
            left:window.pageXOffset
        }
    }else{
        return {
            top:document.body.scrollTop+document.documentElement.scrollTop,
            left:document.body.scrollLeft+document.documentElement.scrollLeft
        }
    }
}

window.onscroll=function(){
var canshu=document.getElementsByClassName("canshu1")[0]
var xqy=document.getElementsByClassName("xqy1")[0]
    let distance =getScroll().top;
    if(distance>236){
      canshu.className="canshu1 canshu-1"
        xqy.style.marginTop="73px";
    }else{
       canshu.className="canshu1"
       xqy.style.marginTop="0"
    }
}
//增加商品
$(".xqy8-1").click(()=>{
    $.ajax({
        url:'http://localhost/interface/add.php',
        type:"post",
        data:{
            id:$("#wyx").text(),
            name:$(".xqy7>p").text(),
            num:$(".slds").val(),
            price:$(".xqy7 span").text(),
            img:$(".xqy1 img").attr('src'),
        },
        dataType:"json",
        success:(res)=>{
            console.log(res)
            alert("添加成功")
        }
    })
})